﻿@inherits RazorFunction

@functions {
    public override string FunctionDescription
    {
        get  { return "A demo function that outputs a hello message."; }
    }
     
    [FunctionParameter(Label = "Statement content")]
    public XhtmlDocument Statement { get; set; }

    private const string stamentTextColorWidgetMarkup = @"<f:widgetfunction xmlns:f=""http://www.composite.net/ns/function/1.0"" name=""Composite.Widgets.String.Selector""><f:param name=""Options""><f:function name=""Composite.Utils.String.Split""><f:param name=""String"" value=""light,dark"" /></f:function></f:param></f:widgetfunction>";
    [FunctionParameter(Label = "Statement text color", DefaultValue = "light", WidgetMarkup = stamentTextColorWidgetMarkup)]
    public string StatementTextColor { get; set; }
	
    [FunctionParameter(Label = "Background Image", DefaultValue=null)]
    public DataReference<IImageFile> BackgroundImage { get; set; }
	
	private string JumbotronInlineStyle()
	{
		return (BackgroundImage!=null ? "background-image:url('~/media(" + BackgroundImage.Data.Id.ToString() + ")');" : "");
		
	}
	
}

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://www.composite.net/ns/function/1.0">
    <head>
    </head>
    <body>
        <div class="jumbotron jumbotron-@StatementTextColor" style="@JumbotronInlineStyle()">
            <div class="overlay">
                <div class="container ">
                    <div class="jumbotron-content">
                        @Markup(Statement)
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>